/**
 * Copyright By Nanjing Fujitsu Nanda Software Technology Co., Ltd
 * 上午10:26:01
 * CoreUserService.java
 * 
 */
package com.fujitsu.nanjing.mobile.service;

import com.fujitsu.nanjing.mobile.common.StringUtils;
import com.fujitsu.nanjing.mobile.dao.CoreUserDao;
import com.fujitsu.nanjing.mobile.model.hibernate.CoreUser;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import javax.annotation.Resource;

/**
 * @author qixb.fnst
 * 
 */
@Service
@Transactional
public class CoreUserService implements BaseService<CoreUser> {
    @Resource
    private CoreUserDao coreUserDao;

    @Override
    public CoreUser find(int id) {

        return coreUserDao.query(CoreUser.class, id);
    }

    @Override
    public CoreUser modify(CoreUser t) {

        return coreUserDao.update(t);
    }

    @Override
    public void delete(CoreUser t) {
        coreUserDao.delete(t);

    }

    @Override
    public CoreUser add(CoreUser t) {

        return coreUserDao.insert(t);
    }

    @Override
    public List<CoreUser> find(String queryString) {

        return coreUserDao.query(queryString);
    }

    /**
     * qixib.fnst
     * 
     * @param company
     * @param username
     * @param password
     */
    public CoreUser checkUser(String company, String username, String password) {
        password = StringUtils.encrypt(password);
        return coreUserDao.checkUser(company, username, password);

    }

    /**
     * qixib.fnst
     * 
     * @param object
     * @param i
     * @return
     */
    public int getUserNums(String WhereClause) {

        return coreUserDao.getUserNums(WhereClause);

    }

    /**
     * qixib.fnst
     * 
     * @param object
     * @param object2
     * @param b
     * @param i
     * @param j
     * @return
     */
    public List<CoreUser> getUsers(String orderClase, String whereClause,
            boolean userLimit, int firstRecord, int limit) {

        return coreUserDao.getUsers(orderClase, whereClause, userLimit,
                firstRecord, limit);
    }

}
